package com.mty.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ：Teacher马（2508531326@qq.com）
 * @date ：Created in 2022/11/1 15:44
 * @description：
 * @modified By：
 * @version:
 */
@Controller
public class MySecurityController {

        @GetMapping("info")
        @ResponseBody
        public Authentication info () {
            return SecurityContextHolder.getContext().getAuthentication();
        }

        @PostMapping("/success")
        public String success () {
            ///templates/success.html
            return "success";
        }
    }
